﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TrainingsApp.WebModel.Debug;
using TrainingsApp.Model;

namespace TrainingsApp.WebModel {
    public class PassPort {
        public static bool IsAuthenticated {
            get {
                return CurrentUser == null ? false : true;
            }
        }

        public static UserContext CurrentUser {
            get {

                return UserStateProvider.GetUserContext();
            }
        }


        static IUserState m_userState;
        static readonly object m_userlock = new object();

        public static IUserState UserStateProvider {
            get {
                if (m_userState == null) {
                    lock (m_userlock) {
                        if (m_userState == null) {
                            m_userState = new ReleaseUserStateProvider();
                        }
                    }
                }
                return m_userState;
            }
        }
    }
}
